/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package creditcardapp.controller;

import framework.controller.IController;
import framework.model.Customer;
import framework.model.Factory;
import framework.model.FinancialCompany;
import creditcardapp.view.MonthlyReportDiaglog;
import java.awt.event.ActionEvent;

/**
 *
 * @author ThanhNguyen
 */
public class GenerateMonthlyBillsController implements IController {

    @Override
    public void actionPerformed(ActionEvent e) {
        //JOptionPane.showMessageDialog(null, "Generate Monthly Bills");
        StringBuilder sb = new StringBuilder();
        FinancialCompany fc = Factory.getInstance().getFinancialCompany();
        for (Customer customer : fc.getCustomers()) {
            sb.append(customer.generateAccountsReport());
        }
        MonthlyReportDiaglog rd = new MonthlyReportDiaglog(null, "Monthly Bills Report", sb.toString());
        rd.setVisible(true);


    }
}
